package com.itheima.exception;

import com.alibaba.fastjson.JSON;
import com.itheima.entity.Result;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

//@Component
//@ControllerAdvice
public class ExceptionAdvice {

    @ExceptionHandler(AccessDeniedException.class)
    @ResponseBody
    public Result doAccessDeniedException(){
        Result result = new Result(false, "权限不足");
        return result;
    }
}
